/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.sgs.persist;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author MaUrO FiLhO
 */
@Entity
@Table(name = "seqmaterial")
@NamedQueries({
    @NamedQuery(name = "Seqmaterial.findAll", query = "SELECT s FROM Seqmaterial s"),
    @NamedQuery(name = "Seqmaterial.findByIdSeqmaterial", query = "SELECT s FROM Seqmaterial s WHERE s.idSeqmaterial = :idSeqmaterial")})
public class Seqmaterial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_seqmaterial")
    private Integer idSeqmaterial;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "seqmaterial")
    private Material material;

    public Seqmaterial() {
    }

    public Seqmaterial(Integer idSeqmaterial) {
        this.idSeqmaterial = idSeqmaterial;
    }

    public Integer getIdSeqmaterial() {
        return idSeqmaterial;
    }

    public void setIdSeqmaterial(Integer idSeqmaterial) {
        this.idSeqmaterial = idSeqmaterial;
    }

    public Material getMaterial() {
        return material;
    }

    public void setMaterial(Material material) {
        this.material = material;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSeqmaterial != null ? idSeqmaterial.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Seqmaterial)) {
            return false;
        }
        Seqmaterial other = (Seqmaterial) object;
        if ((this.idSeqmaterial == null && other.idSeqmaterial != null) || (this.idSeqmaterial != null && !this.idSeqmaterial.equals(other.idSeqmaterial))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.sgs.persist.Seqmaterial[idSeqmaterial=" + idSeqmaterial + "]";
    }

}
